package com.sais.manage.boot.platform.controller;


import com.sais.common.entity.Result;
import com.sais.manage.boot.platform.service.IRsaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 基础平台-加密 controller
 *
 * @author zwp
 * @date 2020/3/14
 **/
@Api(tags = "加密管理")
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/api/platform/rsa")
public class RsaController {

    @Resource
    private IRsaService rsaService;


    @ApiOperation("获取公钥")
    @RequestMapping(value = "/encrypt/{account}",method = RequestMethod.GET)
    public Result getPublicKey(@PathVariable("account") String account) throws Exception {
        String publicKey = rsaService.getPublicKey(account);
        return new Result().data("publicKey",publicKey);
    }



}
